package com.lry.provider.interceptor;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.ext.ReaderInterceptor;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;

public class GZIPWriterInterceptor implements WriterInterceptor {
    //我们写出去的数据开启GZIP压缩
    @Override
    public void aroundWriteTo(WriterInterceptorContext context)
                    throws IOException, WebApplicationException {
//        OutputStream outputStream = context.getOutputStream();
//        context.setOutputStream(new GZIPOutputStream(outputStream));
        context.proceed();
    }
}
